#include <stdio.h>
#include <flgrCoreData.h>
#include <flgrCoreDataIO.h>
#include <flgrCoreCopy.h>
#include <flgrArithShift.h>
#include "../macro.h"



/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_convolution types
/////////////////////////////////////////////////////////////////////////
#define tstArith1d_Sup_Shift_Right(dtype)				\
									\
  dtype rawsrc1[] = {1, 1, 2, 3, 1, 0, 0, 2, 0, 0,			\
		     1, 1, 0, 2, 3, 0, 0, 2, 3, 0,			\
		     0, 1, 2, 2, 3, 0, 9, 2, 0, 0,			\
		     0, 1, 2, 0, 3, 1, 0, 2, 0, 0,			\
		     1, 1, 2, 2, 3, 0, 0, 2, 3, 0,			\
		     0, 1, 2, 1, 1, 0, 5, 2, 3, 0,			\
		     1, 1, 0, 2, 0, 2, 0, 2, 0, 0,			\
		     0, 1, 2, 2, 3, 0, 3, 2, 3, 0};			\
									\
  dtype rawref[]  = {1, 1, 2, 3, 3, 1, 0, 2, 2, 0,			\
		     1, 1, 1, 2, 3, 3, 0, 2, 3, 3,			\
		     0, 1, 2, 2, 3, 3, 9, 9, 2, 0,			\
		     0, 1, 2, 2, 3, 3, 1, 2, 2, 0,			\
		     1, 1, 2, 2, 3, 3, 0, 2, 3, 3,			\
		     0, 1, 2, 2, 1, 1, 5, 5, 3, 3,			\
		     1, 1, 1, 2, 2, 2, 2, 2, 2, 0,			\
		     0, 1, 2, 2, 3, 3, 3, 3, 3, 3};			\
									\
  FLGR_Data1D *datsrc1, *datref, *dat;					\
  FLGR_Ret ret;								\
									\
  datsrc1=flgr1d_create_signal(80,1,flgr_get_type_from_string(#dtype)); \
  datref =flgr1d_create_signal(80,1,flgr_get_type_from_string(#dtype)); \
  dat    =flgr1d_create_signal(80,1,flgr_get_type_from_string(#dtype)); \
  									\
  flgr1d_import_raw_ptr(datsrc1, rawsrc1);				\
  flgr1d_import_raw_ptr(datref, rawref);				\
									\
  ret=flgr1d_arith_sup_shift_right(dat, datsrc1, 1);			\
  check_and_display_data1d(datref, dat, ret);				\
									\
  flgr1d_destroy(datsrc1);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(dat);							\
									\
  return 1


int testArith1d_Sup_Shift_Right_fgBIT(void) {
  tstArith1d_Sup_Shift_Right(fgBIT);
}
int testArith1d_Sup_Shift_Right_fgUINT8(void) {
  tstArith1d_Sup_Shift_Right(fgUINT8);
}
int testArith1d_Sup_Shift_Right_fgUINT16(void) {
  tstArith1d_Sup_Shift_Right(fgUINT16);
}
int testArith1d_Sup_Shift_Right_fgUINT32(void) {
  tstArith1d_Sup_Shift_Right(fgUINT32);
}
int testArith1d_Sup_Shift_Right_fgINT8(void) {
  tstArith1d_Sup_Shift_Right(fgINT8);
}
int testArith1d_Sup_Shift_Right_fgINT16(void) {
  tstArith1d_Sup_Shift_Right(fgINT16);
}
int testArith1d_Sup_Shift_Right_fgINT32(void) {
  tstArith1d_Sup_Shift_Right(fgINT32);
}
int testArith1d_Sup_Shift_Right_fgFLOAT32(void) {
  tstArith1d_Sup_Shift_Right(fgFLOAT32);
}
int testArith1d_Sup_Shift_Right_fgFLOAT64(void) {
  tstArith1d_Sup_Shift_Right(fgFLOAT64);
}



/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_convolution types
/////////////////////////////////////////////////////////////////////////
#define tstArith1d_Inf_Shift_Right(dtype)				\
									\
  dtype rawsrc1[] = {0, 1, 2, 2, 3, 0, 0, 0, 3, 0};			\
									\
  dtype rawref[]  = {0, 0, 1, 2, 2, 0, 0, 0, 0, 0};			\
									\
  FLGR_Data1D *datsrc1, *datref, *dat;					\
  FLGR_Ret ret;								\
									\
  datsrc1=flgr1d_create_signal(10,1,flgr_get_type_from_string(#dtype)); \
  datref =flgr1d_create_signal(10,1,flgr_get_type_from_string(#dtype)); \
  dat    =flgr1d_create_signal(10,1,flgr_get_type_from_string(#dtype)); \
  									\
  flgr1d_import_raw_ptr(datsrc1, rawsrc1);				\
  flgr1d_import_raw_ptr(datref, rawref);				\
									\
  ret=flgr1d_arith_inf_shift_right(dat, datsrc1, 1);			\
  check_and_display_data1d(datref, dat, ret);				\
									\
  flgr1d_destroy(datsrc1);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(dat);							\
									\
  return 1


int testArith1d_Inf_Shift_Right_fgBIT(void) {
  tstArith1d_Inf_Shift_Right(fgBIT);
}
int testArith1d_Inf_Shift_Right_fgUINT8(void) {
  tstArith1d_Inf_Shift_Right(fgUINT8);
}
int testArith1d_Inf_Shift_Right_fgUINT16(void) {
  tstArith1d_Inf_Shift_Right(fgUINT16);
}
int testArith1d_Inf_Shift_Right_fgUINT32(void) {
  tstArith1d_Inf_Shift_Right(fgUINT32);
}
int testArith1d_Inf_Shift_Right_fgINT8(void) {
  tstArith1d_Inf_Shift_Right(fgINT8);
}
int testArith1d_Inf_Shift_Right_fgINT16(void) {
  tstArith1d_Inf_Shift_Right(fgINT16);
}
int testArith1d_Inf_Shift_Right_fgINT32(void) {
  tstArith1d_Inf_Shift_Right(fgINT32);
}
int testArith1d_Inf_Shift_Right_fgFLOAT32(void) {
  tstArith1d_Inf_Shift_Right(fgFLOAT32);
}
int testArith1d_Inf_Shift_Right_fgFLOAT64(void) {
  tstArith1d_Inf_Shift_Right(fgFLOAT64);
}





/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_convolution types
/////////////////////////////////////////////////////////////////////////
#define tstArith1d_Sup_Shift_Left(dtype)				\
  									\
  dtype rawsrc1[] = {0, 1, 2, 2, 3, 0, 0, 0, 3, 0};			\
									\
  dtype rawref[]  = {1, 2, 2, 3, 3, 0, 0, 3, 3, 0};			\
									\
  FLGR_Data1D *datsrc1, *datref, *dat;					\
  FLGR_Ret ret;								\
									\
  datsrc1=flgr1d_create_signal(10,1,flgr_get_type_from_string(#dtype)); \
  datref =flgr1d_create_signal(10,1,flgr_get_type_from_string(#dtype)); \
  dat    =flgr1d_create_signal(10,1,flgr_get_type_from_string(#dtype)); \
  									\
  flgr1d_import_raw_ptr(datsrc1, rawsrc1);				\
  flgr1d_import_raw_ptr(datref, rawref);				\
									\
  ret=flgr1d_arith_sup_shift_left(dat, datsrc1, 1);			\
  check_and_display_data1d(datref, dat, ret);				\
									\
  flgr1d_destroy(datsrc1);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(dat);							\
									\
  return 1


int testArith1d_Sup_Shift_Left_fgBIT(void) {
  tstArith1d_Sup_Shift_Left(fgBIT);
}
int testArith1d_Sup_Shift_Left_fgUINT8(void) {
  tstArith1d_Sup_Shift_Left(fgUINT8);
}
int testArith1d_Sup_Shift_Left_fgUINT16(void) {
  tstArith1d_Sup_Shift_Left(fgUINT16);
}
int testArith1d_Sup_Shift_Left_fgUINT32(void) {
  tstArith1d_Sup_Shift_Left(fgUINT32);
}
int testArith1d_Sup_Shift_Left_fgINT8(void) {
  tstArith1d_Sup_Shift_Left(fgINT8);
}
int testArith1d_Sup_Shift_Left_fgINT16(void) {
  tstArith1d_Sup_Shift_Left(fgINT16);
}
int testArith1d_Sup_Shift_Left_fgINT32(void) {
  tstArith1d_Sup_Shift_Left(fgINT32);
}
int testArith1d_Sup_Shift_Left_fgFLOAT32(void) {
  tstArith1d_Sup_Shift_Left(fgFLOAT32);
}
int testArith1d_Sup_Shift_Left_fgFLOAT64(void) {
  tstArith1d_Sup_Shift_Left(fgFLOAT64);
}






/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_convolution types
/////////////////////////////////////////////////////////////////////////
#define tstArith1d_Inf_Shift_Left(dtype)				\
  									\
  dtype rawsrc1[] = {0, 1, 2, 3, 1, 0, 0, 2, 0, 0,			\
		     0, 1, 0, 2, 3, 0, 0, 2, 3, 0,			\
		     0, 1, 2, 2, 3, 0, 9, 2, 0, 0,			\
		     0, 1, 2, 0, 3, 1, 0, 2, 0, 0,			\
		     0, 1, 2, 2, 3, 0, 0, 2, 3, 0,			\
		     0, 1, 2, 1, 1, 0, 5, 2, 3, 0,			\
		     0, 1, 0, 2, 0, 2, 0, 2, 0, 0,			\
		     0, 1, 2, 2, 3, 0, 3, 2, 3, 0};			\
									\
  dtype rawref[]  = {0, 1, 2, 1, 0, 0, 0, 0, 0, 0,			\
		     0, 0, 0, 2, 0, 0, 0, 2, 0, 0,			\
		     0, 1, 2, 2, 0, 0, 2, 0, 0, 0,			\
		     0, 1, 0, 0, 1, 0, 0, 0, 0, 0,			\
		     0, 1, 2, 2, 0, 0, 0, 2, 0, 0,			\
		     0, 1, 1, 1, 0, 0, 2, 2, 0, 0,			\
		     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,			\
		     0, 1, 2, 2, 0, 0, 2, 2, 0, 0};			\
									\
  FLGR_Data1D *datsrc1, *datref, *dat;					\
  FLGR_Ret ret;								\
									\
  datsrc1=flgr1d_create_signal(80,1,flgr_get_type_from_string(#dtype)); \
  datref =flgr1d_create_signal(80,1,flgr_get_type_from_string(#dtype)); \
  dat    =flgr1d_create_signal(80,1,flgr_get_type_from_string(#dtype)); \
  									\
  flgr1d_import_raw_ptr(datsrc1, rawsrc1);				\
  flgr1d_import_raw_ptr(datref, rawref);				\
									\
  ret=flgr1d_arith_inf_shift_left(dat, datsrc1, 1);			\
  check_and_display_data1d(datref, dat, ret);				\
									\
  flgr1d_destroy(datsrc1);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(dat);							\
									\
  return 1


int testArith1d_Inf_Shift_Left_fgBIT(void) {
  tstArith1d_Inf_Shift_Left(fgBIT);
}
int testArith1d_Inf_Shift_Left_fgUINT8(void) {
  tstArith1d_Inf_Shift_Left(fgUINT8);
}
int testArith1d_Inf_Shift_Left_fgUINT16(void) {
  tstArith1d_Inf_Shift_Left(fgUINT16);
}
int testArith1d_Inf_Shift_Left_fgUINT32(void) {
  tstArith1d_Inf_Shift_Left(fgUINT32);
}
int testArith1d_Inf_Shift_Left_fgINT8(void) {
  tstArith1d_Inf_Shift_Left(fgINT8);
}
int testArith1d_Inf_Shift_Left_fgINT16(void) {
  tstArith1d_Inf_Shift_Left(fgINT16);
}
int testArith1d_Inf_Shift_Left_fgINT32(void) {
  tstArith1d_Inf_Shift_Left(fgINT32);
}
int testArith1d_Inf_Shift_Left_fgFLOAT32(void) {
  tstArith1d_Inf_Shift_Left(fgFLOAT32);
}
int testArith1d_Inf_Shift_Left_fgFLOAT64(void) {
  tstArith1d_Inf_Shift_Left(fgFLOAT64);
}



